const path = require('path');
const webpack = require('webpack');
module.exports = {
	entry:'./source/index.js',

	plugins: [
	    new webpack.HotModuleReplacementPlugin() // Enable HMR
	  ],

	output:{
		filename:'bundle.js',
		path:path.resolve(__dirname,'dist'),
    	publicPath: '/'
	},

	devServer: {
	    hot: true, // Tell the dev-server we're using HMR
	    contentBase: path.resolve(__dirname, 'dist'),
	    publicPath: '/',
		compress: true,
		port: 9000
	},

	module: {
	    rules: [
	    	{
	      		test: /\.(js|jsx)$/,
				loader:'babel-loader?cacheDirectory',
	        	exclude: /node_modules/
	      },
	      {
	        test: /\.css$/,
	        include: /node_modules/,
	        loader: 'style-loader!css-loader?modules&importLoaders=1&localIdentName=[path]__[name]__[local]___[hash:base64:5]'
	        // loader: 'happypack/loader?id=css'
	      },
	      {
	        test: /\.less$/,
	        loader: 'style-loader!css-loader?modules&importLoaders=1&localIdentName=[path]__[name]__[local]___[hash:base64:5]!less-loader'
	        // loader: 'happypack/loader?id=less'
	      },
	      {
	        test: /\.html$/,
	        loader: 'html-loader'
	      },
	      {
	        test: /\.json$/,
	        loader: 'json-loader'
	      },
	      {
	        test: /\.(eot|svg|ttf|woff|woff2)$/,
	        loader: 'file-loader'
	      },
	      {
	        test: /\.(jpg|png|gif|jpeg)$/,
	        loaders: [
	          'file-loader?limit=5000&hash=sha512&digest=hex&size=16&name=[name].[ext]?[hash]'
	        ]
	      }
	    ]
	  },
}